﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Ciep.WebSite
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Ciep.WebSite",
                url: "Ciep/{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional },
                namespaces: new string[] { 
                    "Ciep.WebSite.Controllers" 
                }
            );

            routes.MapRoute(
                name: "Happy.Cms",
                url: "Happy/Cms/{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional },
                namespaces: new string[] { 
                    "Happy.Cms.Controllers",
                    "Happy.Cms.Controllers.Articles" ,
                    "Happy.Cms.Controllers.Categories" ,
                    "Happy.Cms.Controllers.Contacts" ,
                    "Happy.Cms.Controllers.Tags" ,
                    "Happy.Cms.Controllers.Tags" 
                }
            );

            routes.MapRoute(
                name: "Happy.Navigation",
                url: "Happy/Navigation/{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional },
                namespaces: new string[] { 
                    "Happy.Navigation.Controllers",
                    "Happy.Navigation.Controllers.Menus" 
                }
            );

            routes.MapRoute(
                name: "Happy.Security",
                url: "Happy/Security/{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional },
                namespaces: new string[] { 
                    "Happy.Security.Controllers",
                    "Happy.Security.Controllers.Authentication",
                    "Happy.Security.Controllers.Users" 
                }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}